package com.wm.task1.client;

import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class LinkServer {
    private String path = "127.0.0.1";
    private int port = 8866;

    public Integer linkServer(String equation){
        Integer result = null;
        try {
            Socket socket = new Socket(path,port);
            ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
            ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());

            oos.writeObject(equation);
            oos.flush();

            result = (Integer) ois.readObject();

            ois.close();
            oos.close();
            socket.close();
        }catch (Exception e){}
        return result;
    }

}
